
import Request from "@/utils/http.js"
import {BASE_PATH} from "@/utils/config.js"
import {getStorage} from "@/utils/common.js"

export const getAccessToken = (params,callback)=>{ 
	return new Promise((resolve,reject) =>{
		Request({
			url: '/qy-wechat/get/access_token',
			method:'GET',
			data: params,
			success: res => {
				resolve(res)
				callback && callback(res);
			},
			fail: res => {
				resolve(res)
				callback && callback(res);
			}
		})
	})
}
// 通过手机号获取企业员工的userid
export const getUserid = (params,callback)=>{ 
	return new Promise((resolve,reject) =>{
		Request({
			url: '/qy-wechat/get/userid',
			method:'POST',
			data: params,
			success: res => {
				resolve(res)
				callback && callback(res);
			},
			fail: res => {
				resolve(res)
				callback && callback(res);
			}
		})
	})
}
// 获取客户扫描加入二维码（以企业某个员工生成加入二维码）
export const getJoinQrCode = (params,callback)=>{ // 
	return new Promise((resolve,reject) =>{
		Request({
			url: '/qy-wechat/create/qr_code',
			method:'POST',
			data: params,
			success: res => {
				resolve(res)
				callback && callback(res);
			},
			fail: res => {
				resolve(res)
				callback && callback(res);
			}
		})
	})
}

// 获取某个员工下的客户列表
export const getCustomList = (params,callback)=>{ // 
	return new Promise((resolve,reject) =>{
		Request({
			url: '/qy-wechat/get/custom/list',
			method:'POST',
			data: params,
			success: res => {
				resolve(res)
				callback && callback(res);
			},
			fail: res => {
				resolve(res)
				callback && callback(res);
			}
		})
	})
}

// 获取客户详情
export const getCustomDetail = (params,callback)=>{ // 
	return new Promise((resolve,reject) =>{
		Request({
			url: '/qy-wechat/get/custom/detail',
			method:'POST',
			data: params,
			success: res => {
				resolve(res)
				callback && callback(res);
			},
			fail: res => {
				resolve(res)
				callback && callback(res);
			}
		})
	})
}

// 创建预约会议
export const createMeeting = (params,callback)=>{ // 
	return new Promise((resolve,reject) =>{
		Request({
			url: '/qy-wechat/meeting/create',
			method:'POST',
			data: params,
			success: res => {
				resolve(res)
				callback && callback(res);
			},
			fail: res => {
				resolve(res)
				callback && callback(res);
			}
		})
	})
}

// 获取会议详情
export const getMeetingDetail = (params,callback)=>{ // 
	return new Promise((resolve,reject) =>{
		Request({
			url: '/qy-wechat/get/meeting/detail',
			method:'POST',
			data: params,
			success: res => {
				resolve(res)
				callback && callback(res);
			},
			fail: res => {
				resolve(res)
				callback && callback(res);
			}
		})
	})
}

// 内部人员消息推送
export const sendMessage = (params,callback)=>{ // 
	return new Promise((resolve,reject) =>{
		Request({
			url: '/qy-wechat/send/internal/message',
			method:'POST',
			data: params,
			success: res => {
				resolve(res)
				callback && callback(res);
			},
			fail: res => {
				resolve(res)
				callback && callback(res);
			}
		})
	})
}

// 创建朋友圈消息
export const createMessageToFriendsCircle = (params,callback)=>{ // 
	return new Promise((resolve,reject) =>{
		Request({
			url: '/qy-wechat/friends-circle/message/add',
			method:'POST',
			data: params,
			success: res => {
				resolve(res)
				callback && callback(res);
			},
			fail: res => {
				resolve(res)
				callback && callback(res);
			}
		})
	})
}

// 获取客户标签列表
export const getCustomTagList = (params,callback)=>{ 
	return new Promise((resolve,reject) =>{
		Request({
			url: '/qy-wechat/tag/list',
			method:'POST',
			data: params,
			success: res => {
				resolve(res)
				callback && callback(res);
			},
			fail: res => {
				resolve(res)
				callback && callback(res);
			}
		})
	})
}

// 创建客户标签（标签组）
export const addTag = (params,callback)=>{ 
	return new Promise((resolve,reject) =>{
		Request({
			url: '/qy-wechat/add/tag',
			method:'POST',
			data: params,
			success: res => {
				resolve(res)
				callback && callback(res);
			},
			fail: res => {
				resolve(res)
				callback && callback(res);
			}
		})
	})
}






